/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.notice.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.notice.annotation.MsgNotice;
import org.springblade.modules.notice.entity.BizMsgConfig;
import org.springblade.modules.notice.enums.BusinessType;
import org.springblade.modules.notice.enums.TriggerNodeEnum;
import org.springblade.modules.notice.mapper.BizMsgConfigMapper;
import org.springblade.modules.notice.service.IBizMsgConfigService;
import org.springblade.modules.notice.vo.BizMsgConfigListParam;
import org.springblade.modules.notice.vo.BizMsgConfigVO;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 业务消息管理表 服务实现类
 *
 * @author ysq
 * @since 2024-11-20
 */
@Service
public class BizMsgConfigServiceImpl extends BaseServiceImpl<BizMsgConfigMapper, BizMsgConfig> implements IBizMsgConfigService {

	@Override
	public IPage<BizMsgConfigVO> selectBizMsgConfigPage(IPage<BizMsgConfigVO> page, BizMsgConfigVO bizMsgConfig) {
		return page.setRecords(baseMapper.selectBizMsgConfigPage(page, bizMsgConfig));
	}

	@Override
	public boolean customUpdate(BizMsgConfig bizMsgConfig) {
		return this.updateById(bizMsgConfig);
	}

	@Override
	public List<BizMsgConfig> getBizMsgConfigList(BizMsgConfigListParam param) {
		return baseMapper.getBizMsgConfigList(param);
	}

	@Override
	@MsgNotice(businessType = BusinessType.REPAIR, node = TriggerNodeEnum.REMINDER, parameterSource = 1, parameterName = "id")
	public Map<String, Object> test(Long id) {
		Map<String, Object> map = new HashMap<>(2);
		map.put("id", id);
		return map;
	}


}
